#include "include/FramelessWidget/frameless_widget.h"
#include "include/Buttons/loading_button.h"
#include "include/Buttons/loading_button_2.h"
#include "include/gant_factory.h"

#include "../MyPlugins/interface/interface.h"

#include <QApplication>
#include <QMainWindow>
#include <QHBoxLayout>
#include <QLabel>
#include <QMovie>
#include <QLibrary>
#include <QPluginLoader>

int main(int argc, char* argv[])
{
	QApplication a(argc, argv);
	//GAntUi w;
	//w.show();

	QPluginLoader pluginLoader("./MyPlugins.dll");
	QObject* plugin = pluginLoader.instance();
	qDebug() << __FUNCTION__ << pluginLoader.errorString();
	if (plugin) {
		auto m_pInterface = qobject_cast<MyPluginsInterface*>(plugin);
		if (!m_pInterface) {
			qDebug() << "qobject_cast error";
			return true;
		}

		qDebug() << m_pInterface->add(1, 2);
	}
	//QMainWindow m;
	//auto l = new QHBoxLayout(&m);

	//QLibrary lib("./GAntUi.dll");
	//if (lib.load()) {
	//	auto loadFactory = (std::unique_ptr<LoadingButton2> (*)(QWidget*))(lib.resolve("createLoadingButton2"));
	//	auto b = loadFactory(&m);
	//	//auto b = new LoadingButton2(&m);
	//	b->setIcon(QPixmap(R"(D:\Desktop\favicon.ico)"));
	//	b->setMovie(R"(D:\Desktop\loading.gif)");
	//	b->setText("123");
	//	l->addWidget(b.get());
	//	//GAntFramelessWidget w;
	//	//w.setContentWidget(b);
	//	////auto l = new QLabel{ "Content!" };
	//	////l->setStyleSheet("background-color: gray;");
	//	////w.setContentWidget(l);
	//	//w.show();
	//	//w.setFixedSize(400, 500);
	//	//w.setMinimumSize(200, 300);
	//	//w.setMoveable(false);
	//	m.show();
	//}
	
	return a.exec();
}
